#include<iostream>
using namespace std;
const int N = 3010;
int m, n;
int a[N][N], f[N][N];
int main()
{
    scanf("%d %d",&m,&n);
    for (int i = 1;i <= m;i++)
    {
        for (int j = 1;j <= n;j++)
        {
            scanf("%d",&a[i][j]);
        }
    }
    f[m][0] = 1;
    for (int i = m;i >= 1;i--)
    {
        for (int j = 1;j <= n;j++)
        {
            if (a[i][j] == 0)
                f[i][j] = (f[i + 1][j] + f[i][j - 1])%2333;
        }
    }
    cout<<f[1][n]<<endl;
    return 0;
}